<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Generalized Linear Mixed Models using AD Model Builder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>

<table width="100%" summary="page for glmm.admb {glmmADMB}"><tr><td>glmm.admb {glmmADMB}</td><td align="right">R Documentation</td></tr></table>
<h2>Generalized Linear Mixed Models using AD Model Builder</h2>


<h3>Description</h3>

<p>
Fits mixed-effects models to count data using Binomial, Poisson or
negative binomial response distributions. Zero-inflated versions of 
Poisson and negative binomial distributions are available.
</p>


<h3>Usage</h3>

<pre> glmm.admb(fixed, random, group, data, family = "poisson", link, corStruct = "diag", 
                impSamp = 0, easyFlag = TRUE, zeroInflation = FALSE, imaxfn = 10, save.dir= NULL)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>fixed</code></td>
<td>
a two-sided linear formula object describing the
fixed-effects part of the model, with the response on the
left of a '~' operator and the terms, separated by '+'
operators, on the right.</td></tr>
<tr valign="top"><td><code>random</code></td>
<td>
optionally, a one-sided formula object describing the
random-effects part of the model. When 'random' is missing
an ordinary GLM without random effects is fitted.</td></tr>
<tr valign="top"><td><code>group</code></td>
<td>
a character string naming the main nesting variable.</td></tr>
<tr valign="top"><td><code>data</code></td>
<td>
a data frame containing the variables named in 'fixed', 'random' and 'group'.</td></tr>
<tr valign="top"><td><code>family</code></td>
<td>
a character string determining the response distribution: "poisson" or "nbinom".</td></tr>
<tr valign="top"><td><code>link</code></td>
<td>
a character string specifying the shape of the link function ("logit" or "probit") used for the "binomial" family.</td></tr>
<tr valign="top"><td><code>corStruct</code></td>
<td>
a character string specifying the covariance structure of the random effects vector. 
Two types of covariance matrices are are currently implemented: "diag" (diagonal matrix) and "full"
(positive definite matrix with all elements being estimated).</td></tr>
<tr valign="top"><td><code>impSamp</code></td>
<td>
integer.  The sample size in the importance sampling correction of the Laplace approximation 
(impSamp=0 yields a plain Laplace approximation).</td></tr>
<tr valign="top"><td><code>easyFlag</code></td>
<td>
logical.  If 'TRUE', a faster but less robust optimization algorithm is employed (only "poisson" and "nbinom").</td></tr>
<tr valign="top"><td><code>zeroInflation</code></td>
<td>
logical.  If 'TRUE', a zero-inflated model is fitted (only "poisson" and "nbinom")</td></tr>
<tr valign="top"><td><code>imaxfn</code></td>
<td>
integer. Number of function evaluations used in intermediate optimization steps.</td></tr>
<tr valign="top"><td><code>save.dir</code></td>
<td>
If a quoted directory name is specified all the ADMB output files are saved there.</td></tr>
</table>

<h3>Details</h3>

<p>
Currently, the "binomial" familiy only accepts Bernoully responce (0 or 1).
</p>
<p>
Parameterization of the negative binomial distribution: Var(Y) = E(Y)*(1+E(Y)/alpha).
</p>
<p>
Zero-inflation: With probability '1-pz' Y comes from a Poisson (or negative binomial) distribution,
and with probability 'pz' Y is zero (Bohning et al., 1999). Only available with "poisson" and "nbinom" response.
</p>
<p>
Parameters are estimated by maximum likelihood using the Laplace approximation to evaluate the marginal 
likelihood. When 'impSamp &gt; 0' importance sampling is used to improve the
Laplace approximation (Skaug and Fournier, 2005).
</p>
<p>
If the message 'Proper convergence could not be reached' occurs, try to increase the parameter 'imaxfn'
and to set 'easyFlag = FALSE'.
</p>


<h3>Value</h3>

<p>
An object of class 'glmm.admb' representing the  model fit. 
The generic function 'print' has a method to show the results of the fit.
</p>
<table summary="R argblock">
<tr valign="top"><td><code>b</code></td>
<td>
vector of fixed effects</td></tr>
<tr valign="top"><td><code>S</code></td>
<td>
covariance matrix of random effects</td></tr>
<tr valign="top"><td><code>alpha</code></td>
<td>
parameter in negative binomial distribution (only when 'family = "poisson"')</td></tr>
<tr valign="top"><td><code>pz</code></td>
<td>
Zero-inflation parameter (only when 'zeroInflation = TRUE')</td></tr>
</table>

<h3>Author(s)</h3>

<p>
H. Skaug skaug@mi.uib.no, David Fournier otter@otter-rsch.com and Anders Nielsen andersn@hawaii.edu
</p>


<h3>References</h3>

<p>
Bohning, D. et al (1999). The Zero-Inflated Poisson Model and the Decayed, Missing and Filled Teeth Index in Dental Epidemiology.
Journal of the Royal Statistical Society. Series A (Statistics in Society)  Vol. 162, No. 2 (1999), pp. 195-209.
</p>
<p>
Skaug and Fournier (2005). Automatic Evaluation of the Marginal Likelihood in Nonlinear Hierarchical Models. Unpublished
available from: http://bemata.imr.no/laplace.pdf
</p>


<h3>Examples</h3>

<pre>
  data(epil2)
  glmm.admb(y~Base*trt+Age+Visit,random=~Visit,group="subject",data=epil2,family="nbinom")
</pre>



<hr><div align="center">[Package <em>glmmADMB</em> version 0.3 <a href="00Index.html">Index]</a></div>

</body></html>
